class Error(Exception):
	pass

class RepositoryError(Error):
	pass


class DBError(RepositoryError):
	pass


class ObjectDoesNotExist(DBError):
	pass


class MultipleResultError(DBError):
	pass


class AuthenticationError(RepositoryError):
	pass


class IntegrityError(RepositoryError):
	pass


class SubmissionError(RepositoryError):
	pass


class CommandError(Error):
	pass


class FieldError(Error):
	def __init__(self, message, name=None):
		super(FieldError, self).__init__(message)
		self.name = name

class FieldValueError(FieldError):
	NOT_SET = object()

	def __init__(self, message, name=NOT_SET, value=NOT_SET):
		super(FieldValueError, self).__init__(message, name)
		self.value = value

	def __str__(self):
		items = [super(FieldValueError, self).__str__()]
		if self.name != self.NOT_SET:
			items.append(repr(self.name))
		if self.value != self.NOT_SET:
			items.append('value {0!r}'.format(self.value))
		return ': '.join(items)
